#include <stdio.h>
#include <windows.h>

// Utilities to convert between ADDRESS and LPVOID
union Int2Ptr {
    UINT_PTR uip;
    LPVOID lpv;
};

inline UINT_PTR Ptr2Addrint(LPVOID ptr);
inline LPVOID Addrint2Ptr(UINT_PTR ptr);


inline UINT_PTR Ptr2Addrint(LPVOID ptr)
{
    Int2Ptr i2p;
    i2p.lpv = ptr;
    return i2p.uip;
}

inline LPVOID Addrint2Ptr(UINT_PTR ptr)
{
    Int2Ptr i2p;
    i2p.uip = ptr;
    return i2p.lpv;
}


int main(int argc, char** argv)
{
    printf("hello world!\n");
	UINT_PTR srcAddr = Ptr2Addrint(&main);
	printf("srcAddr=%p\n",srcAddr);
    LPVOID tgtAddr = Addrint2Ptr(srcAddr);
	printf("tgtAddr=%p\n",tgtAddr);
	
    return 0;
}
